package com.czl.dxpro.dx_03_sta;
import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import com.czl.dxpro.dx_04_utils.TProperties;
                                           //输入v，             输入v，
public class DxStaOneMapper extends Mapper<LongWritable,Text,Text,IntWritable>{
	protected void map(LongWritable key, Text value, 
			Mapper<LongWritable, Text, Text, IntWritable>.Context context)
			throws IOException, InterruptedException {
		
		//输入数据后，获取 行为id & 用户id
		String[] values = value.toString().split(TProperties.getValue("fileoutsplit"));//    \\|   ==   |
		// values[0]是行为id  values[1]是用户id
		Text k = new Text();
		IntWritable v = new IntWritable(1);   //单词统计
		k.set(values[0].substring(0,6)+"000000000000"+TProperties.getValue("outfilesplit")+values[1]);
		context.write(k, v);   //k，v和上面key value区分开
		
		System.out.println("~~~~~~mapper1 test"+k.toString());
	}

}
